package com.pignest.hotel.spring;

import com.pignest.hotel.service.AdminService;
import com.pignest.hotel.service.AuditService;
import com.pignest.hotel.service.CardService;
import com.pignest.hotel.service.CustomService;
import com.pignest.hotel.service.DictionaryService;
import com.pignest.hotel.service.GlobalService;
import com.pignest.hotel.service.GoodsService;
import com.pignest.hotel.service.IncomeService;
import com.pignest.hotel.service.MemberService;
import com.pignest.hotel.service.MenuLoader;
import com.pignest.hotel.service.OtherBusiService;
import com.pignest.hotel.service.ReceptionService;
import com.pignest.hotel.service.ReportService;
import com.pignest.hotel.service.RoleService;
import com.pignest.hotel.service.RoomService;
import com.pignest.hotel.service.UserService;

public class Services {

	private static GlobalService globalService;
	private static UserService userService;
	private static RoomService roomService;
	private static DictionaryService dictionaryService;
	private static ReceptionService receptionService;
//	private static OrgService orgService;
	private static MemberService memberService;
	private static IncomeService incomeService; 
	//private static InComeItemService inComeItemService;
	private static RoleService roleService;
	private static MenuLoader menuLoader;
	private static AdminService adminService;
	private static AuditService auditService;
	private static CardService cardService;
	private static GoodsService goodsService;
	private static CustomService customService;
	private static ReportService reportService;
	private static OtherBusiService otherBusiService;
	public static ReportService getReportService() {
		if (reportService == null)
			reportService = getBean("reportService");
		return reportService;
	}
	
	public static GlobalService getGlobalService() {
		if (globalService == null)
			globalService = getBean("globalService");
		return globalService;
	}
	
	public static RoleService getRoleService() {
		if (roleService == null)
			roleService = getBean("roleService");
		return roleService;
	}
	
	/*public static InComeItemService getInComeItemService(){
		if (inComeItemService == null)
			inComeItemService = getBean("inComeItemService");
		return inComeItemService;
	}*/
	
	public static IncomeService getIncomeService(){
		if (incomeService == null)
			incomeService = getBean("incomeService");
		return incomeService;
	}
	
	public static UserService getUserService(){
		if (userService == null)
			userService = getBean("userService");
		return userService;
	}
	
	public static RoomService getRoomService() {
		if (roomService == null)
			roomService = getBean("roomService");
		return roomService;
	}
	
	public static DictionaryService getDictionaryService() {
		if (dictionaryService == null)
			dictionaryService = getBean("dictionaryService");
		return dictionaryService;
	}
	
	public static ReceptionService getReceptionService() {
		if (receptionService == null)
			receptionService = getBean("receptionService");
		return receptionService;
	}
	
	public static MemberService getMemberService(){
		if(memberService==null){
			memberService=getBean("memberService");
		}
		return memberService;
	}
	
	public static MenuLoader getMenuLoader() {
		if (menuLoader == null)
			menuLoader = getBean("menuLoader");
		return menuLoader;
	}
	
	public static AdminService getAdminService() {
		if (adminService == null)
			adminService = getBean("adminService");
		return adminService;
	}

	public static AuditService getAuditServcie() {
		if (auditService == null)
			auditService = getBean("auditService");
		return auditService;
	}
	
	public static CardService getCardService() {
		if (cardService == null)
			cardService = getBean("cardService");
		return cardService;
	}
	public static GoodsService getGoodsService(){
		if(goodsService==null)
			goodsService =getBean("goodsService");
		return goodsService;
	}
	public static CustomService getCustomService(){
		if(customService==null)
			customService =getBean("customService");
		return customService;
	}
	public static OtherBusiService getOtherBusiService()
	{
		if(otherBusiService==null)
			otherBusiService =getBean("otherBusiService");
		return otherBusiService;
	}
	@SuppressWarnings("unchecked")
	private static <T> T getBean(String beanName){
		return (T)ContextHolder.getBean(beanName);
	}

}
